a6d1a7bcff7580a2e99e5c6b1f98275747ac8587,plugins/plugin-artik-ide/src/main/java/org/eclipse/che/plugin/artik/ide/profile/SoftwareInstaller.java,SoftwareInstaller,install,#Software#Machine#,65
Before Change
public Promise<Void> install(final Software softwareType, final Machine device) {
Log.debug(getClass(), "Installing missing software: " + softwareType);
final String chanel = "process:output:" + UUID.uuid();
final Promise<Void> promise = createFromAsyncRequest(new AsyncPromiseHelper.RequestCall<Void>() {
@Override
public void makeCall(AsyncCallback<Void> callback) {
readChannel(device.getConfig().getName(), chanel, callback);
}
});
final String commandLine = softwareType.getInstallationCommand() + "echo \">>> end <<<\"";
final String commandName = softwareType.name() + "_installation";
final String commandType = "custom";
final Command command = dtoFactory.createDto(CommandDto.class)
.withName(commandName)
.withType(commandType)
.withCommandLine(commandLine);
Log.debug(getClass(), "Installation command: " + command);
deviceServiceClient.executeCommand(device.getId(), command, chanel);
return promise;
}
After Change
Log.debug(getClass(), "Installation command: " + command);
execAgentCommandManager.startProcess(device.getId(), command).thenIfProcessStartedEvent(processStartedEventDto -> {
}).thenIfProcessDiedEvent(processDiedEventDto -> {
final String softwareInstalledMessage = "Software installed";
notification.setTitle(softwareInstalledMessage);
notification.setStatus(SUCCESS);
processesPanelPresenter.printMachineOutput(device.getConfig().getName(), "\n");
Log.debug(getClass(), message);
}).thenIfProcessStdOutEvent(processStdOutEventDto -> {
processesPanelPresenter.printMachineOutput(device.getConfig().getName(), processStdOutEventDto.getText());
Log.debug(getClass(), message);
}).thenIfProcessStdErrEvent(processStdErrEventDto -> {
processesPanelPresenter.printMachineOutput(device.getConfig().getName(), processStdErrEventDto.getText(), "red");
Log.debug(getClass(), message);